package lesson3.example2;

interface Greeting {
	void sayHello(String name);
}

class GreetingImpl implements Greeting {
	@Override
	public void sayHello(String name) {
		System.out.println("Hello! " + name);
	}
}

public class GreetingProxy implements Greeting {

	private GreetingImpl greetingImpl;

	public GreetingProxy(GreetingImpl greetingImpl) {
		this.greetingImpl = greetingImpl;
	}

	@Override
	public void sayHello(String name) {
		before();
		greetingImpl.sayHello(name);
		after();
	}

	private void before() {
		System.out.println("Before");
	}

	private void after() {
		System.out.println("After");
	}
}